Page({
  data: {
    swiperList:[],
    navList:[],
    productList:[]
  },
  onLoad: function (options) {
    this.getPlayImg();
    this.getNav();
    this.getGoodsAd();
  },
  // 获取轮播图
  getPlayImg(){
    wx.showLoading({
      title: '加载中',
      mask:true
    });
    wx.request({
      url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
      success:(res)=>{
        const data = res.data.message;
        console.log(data)
        this.setData({swiperList:data});
        wx.hideLoading();
      }
    });
  },
  // 获取导航图
  getNav(){
    wx.showLoading({
      title: '加载中',
      mask:true
    });
    wx.request({
      url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/catitems',
      success:(res)=>{
        const data = res.data.message;
        this.setData({navList:data});
        wx.hideLoading();
      }
    })
  },
  // 获取商品广告图
  getGoodsAd(){
    wx.showLoading({
      title: '加载中',
      mask:true
    });
    wx.request({
      url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/floordata',
      success:(res)=>{
        const data = res.data.message;
        this.setData({productList:data});
        wx.hideLoading();
      }
    })
  },
})